///**
// * MyPlaylistAdapter.java
// * 
// * Purpose              :
// * 
// * Optional info        : 
// *
// * @author              : Van Hoang Phuong
// * 
// * @date                : May 23, 2012
// * 
// * @lastChangedRevision : 
// *
// * @lastChangedDate     :
// *
// */
//package com.applink.sell_proof.adapter;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.BaseExpandableListAdapter;
//import android.widget.TextView;
//
//import com.applink.sell_proof.EMarketing;
//import com.applink.sell_proof.R;
//import com.applink.sell_proof.api.DataHelper;
//import com.applink.sell_proof.constant.Constant;
//import com.applink.sell_proof.constant.ItemStatus;
//import com.applink.sell_proof.database.table.ClaimDBHelper;
//import com.applink.sell_proof.database.table.ProjectDBHelper;
//import com.applink.sell_proof.model.Claim;
//import com.applink.sell_proof.model.NewReward;
//import com.applink.sell_proof.model.Project;
//import com.applink.sell_proof.model.Redeem;
//import com.applink.sell_proof.model.Reward;
//import com.applink.sell_proof.util.Utility;
//public class RedeemAdapter extends BaseExpandableListAdapter
//{
//	private LayoutInflater mInflater;
//	
//	private String[] mGroupItems;
//	private List<Redeem> mDraftRedeems;
//	private List<Redeem> mPreviousRedeems;
//	private List<Redeem> mPendingRedeems;
//	
//	private List<NewReward> mReward;
//	private Reward reward ;
//	private List<Project> project;
//	private List<Claim> claim;
//	private ArrayList<NewReward> rewardProject = new ArrayList<NewReward>();
//	private ArrayList<NewReward> rewardClaim = new ArrayList<NewReward>();
//	private ArrayList<NewReward> rewardAll = new ArrayList<NewReward>();
//	int size = 0;
//
//	public RedeemAdapter()
//	{
//		mInflater = LayoutInflater.from(EMarketing.getInstance().getApplicationContext());
////		Constant.dataReward.clear();
////		Constant.totalReward = 0;
////		project = ProjectDBHelper.getProjectsByStatus("'Approved'");
////		size = project.size();
////		for(int i = 0;i< project.size();i++){
////			reward = new Reward();
////			reward.setName(project.get(i).getName());
////			reward.setStatus("Approve");
////			reward.setType("Project");
////			reward.setReward("20");
////			rewardProject.add(reward);
////			Constant.dataReward.add(reward);
////			rewardAll.add(reward);
////			Constant.totalReward = Constant.totalReward + Integer.parseInt(Constant.dataReward.get(i).getReward());
////					 
////			System.out.println(">>>>>> project = "+i+"    =    " + Constant.totalReward );
////		}
////		claim = ClaimDBHelper.getClaimByStatus("'Submitted'");
////		for(int i = 0;i< claim.size();i++){
////			reward = new Reward();
////			reward.setName(claim.get(i).getCustomerCompanyName());
////			reward.setStatus("Submitted");
////			reward.setType("Claim");
////			reward.setReward("20");
////			rewardClaim.add(reward);
////			Constant.dataReward.add(reward);
////			rewardAll.add(reward);
////			Constant.totalReward = Constant.totalReward + Integer.parseInt(Constant.dataReward.get(i).getReward());
////			System.out.println(">>>>>> claim = "+i+"    =    " + Constant.totalReward);	
////		}			
//		init();
//	}
//	
//	public RedeemAdapter(int position){
//		mInflater = LayoutInflater.from(EMarketing.getInstance().getApplicationContext());
//		if(position == 0){
//			Constant.dataReward.clear();
//			Constant.dataReward = rewardAll;			
//		}
//		else if(position == 1){
//			Constant.dataReward.clear();
//			Constant.dataReward = rewardClaim;
//			
//		}else if(position == 2){
//			Constant.dataReward.clear();
//			Constant.dataReward = rewardClaim;			
//		}	
//		init();
//	}
//
//	private void init()
//	{
//		mGroupItems = new String[]{"Reward"};
//		//mGroupItems = new String[]{"Draft","Pending redemption","Previous redemption"};
//	}
//
//	
//	private class ChildHolder
//	{
//		TextView reward_type;
//		TextView reward_name;
//		TextView redeem_product;
//		TextView redeem_status;
//	}
//
//	@Override
//	public Object getChild(int groupPosition, int childPosition)
//	{
//		return mReward.get(0);
////		if(groupPosition == 0) {
////			return mDraftRedeems.get(childPosition);
////		} else if(groupPosition == 1){
////			return mPendingRedeems.get(childPosition);
////		} else {
////			return mPreviousRedeems.get(childPosition);
////		}
//	}
//
//	@Override
//	public long getChildId(int groupPosition, int childPosition)
//	{
//		return childPosition;
//	}
//
//	@Override
//	public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
//	{			
//			ChildHolder holder;
//			if(convertView == null)
//			{
//				holder = new ChildHolder();
//				convertView = mInflater.inflate(R.layout.redeem_item, null);
//				holder.reward_type = (TextView) convertView.findViewById(R.id.reward_type);			
//				holder.reward_name = (TextView) convertView.findViewById(R.id.reward_name);			
//				holder.redeem_product = (TextView) convertView.findViewById(R.id.redeem_product);			
//				holder.redeem_status = (TextView) convertView.findViewById(R.id.redeem_status);			
//				convertView.setTag(holder);
//			}
//			else {
//				holder = (ChildHolder) convertView.getTag();
//			}
//			//if(groupPosition == 0){
////				holder.reward_type.setText(Constant.dataReward.get(childPosition).getType());//mPendingRedeems.get(childPosition).getCampaignName());
////				holder.reward_name.setText(Constant.dataReward.get(childPosition).getName());
////				holder.redeem_product.setText(String.valueOf((Constant.dataReward.get(childPosition).getReward())));
////				holder.redeem_status.setText(Constant.dataReward.get(childPosition).getStatus());
//				
//				holder.reward_type.setText(mReward.get(childPosition).getRewardType());//mPendingRedeems.get(childPosition).getCampaignName());
//				//holder.reward_name.setText(mReward.get(childPosition).getProgramName());
//				holder.redeem_product.setText(String.valueOf((mReward.get(childPosition).getRewardAmount())));
//				holder.redeem_status.setText(String.valueOf((mReward.get(childPosition).getObjectID())));
//			//}
//			
////			System.out.println(">>>>> Type = " + childPosition +"             "+ Constant.dataReward.get(childPosition).getType());
////			System.out.println(">>>>> Name = " + childPosition +"             "+ Constant.dataReward.get(childPosition).getName());
//			
////			if(groupPosition == 0){
////				holder.reward_type.setText(mDraftRedeems.get(childPosition).getCampaignName());
////				holder.reward_name.setText(mDraftRedeems.get(childPosition).getProgramName());
////				holder.redeem_product.setText((mDraftRedeems.get(childPosition).getProduct()));
////				holder.redeem_status.setText((mDraftRedeems.get(childPosition).getStatus()));
////			} else if(groupPosition == 1){
////				holder.reward_type.setText(mPendingRedeems.get(childPosition).getCampaignName());
////				holder.reward_name.setText(mPendingRedeems.get(childPosition).getProgramName());
////				holder.redeem_product.setText((mPendingRedeems.get(childPosition).getProduct()));
////				holder.redeem_status.setText((mPendingRedeems.get(childPosition).getStatus()));
////			} else if(groupPosition == 2) {
////				holder.reward_type.setText(mPreviousRedeems.get(childPosition).getCampaignName());
////				holder.reward_name.setText(mPreviousRedeems.get(childPosition).getProgramName());
////				holder.redeem_product.setText((mPreviousRedeems.get(childPosition).getProduct()));
////				holder.redeem_status.setText((mPreviousRedeems.get(childPosition).getStatus()));
////			}
//		return convertView;
//	}
//
//	@Override
//	public int getChildrenCount(int groupPosition)
//	{
//		switch (groupPosition) {
////		case 0:
////			return  Constant.dataReward != null? Constant.dataReward.size():0;
//		case 0:
//			return mReward != null? mReward.size():0;
////		case 1:
////			return  mPendingRedeems != null? mPendingRedeems.size():0;
////		case 2:
////			return  mPreviousRedeems != null? mPreviousRedeems.size():0;
//		default:
//			break;
//		}
//		return 0;
//	}
//
//	@Override
//	public Object getGroup(int groupPosition) 
//	{
//		return mGroupItems[groupPosition];
//	}
//
//	@Override
//	public int getGroupCount()
//	{
//		return mGroupItems.length;
//	}
//
//	@Override
//	public long getGroupId(int groupPosition)
//	{
//		return groupPosition;
//	}
//
//	@Override
//	public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
//	{
//		if (convertView == null)
//	
//		{
//			convertView = mInflater.inflate(R.layout.header_group_redeem, null);
//		}
//
//		((TextView)convertView).setText(mGroupItems[groupPosition]);
//		
//		return convertView;
//	}
//
//	@Override
//	public boolean hasStableIds()
//	{
//		return true;
//	}
//
//	@Override
//	public boolean isChildSelectable(int groupPosition, int childPosition)
//	{
//		return true;
//	}
//	
//	public void setDraftRedeem(List<Redeem> draftRedeem){
//		mDraftRedeems = draftRedeem;
//		notifyDataSetChanged();
//	}
//	
//	public void setReward(List<NewReward> rewards){
//		mReward = rewards;
//		notifyDataSetChanged();
//	}
//	
//	public void setPendingRedeem(List<Redeem> pendingRedeem){
//		mPendingRedeems = pendingRedeem;
//		notifyDataSetChanged();
//	}
//	
//	public void setPreviousRedeem(List<Redeem> previousRedeem){
//		mPreviousRedeems = previousRedeem;
//		notifyDataSetChanged();
//	}
//}
